package com.tiger.utils;

/**
 * HasId
 * @author andy
 *
 */
public interface HasId {
	
	String getId();
	
	
	public static boolean equals(HasId o1, HasId o2) {
		if (o1 == o2) {
			return true;
		}
		if (o1 == null || o2 == null) {
			return false;
		}
		String id = o1.getId();
		String otherId = o2.getId();
		return id == null ? otherId == null : id.equals(otherId);
	}
	
	public static int hashCode(HasId o) {
		if(o == null) {
			return 0;
		}
		String id = o.getId();
		return id == null ? 0 : id.hashCode();
	}
}
